<?php
/**
 * ShopEx licence
 *
 * -------
 * -------
 */
 
/**
 * 购物车项model
 * $ 2010-04-28 20:02 $
 */
class b2c_cart_objects {
    private $__member_id = null;
        
        
    function __construct( &$app ) {
        $this->app = $app;
    }
    
    public function md5_cart_objects() {
        $arr = $this->app->model('cart')->get_basic_objects();
        $md5 = utils::array_md5($arr);
        return $md5;
    }
    
    
    //购物车会员信息统一接口
   public function get_current_member( $memberid=null ) {
       if( !$memberid ) $memberid = $this->__member_id;
       if( $memberid ) {
           if( $memberid=='-1' ) {
                $this->memberinfo[$memberid]['member_id'] = '-1';
                $this->memberinfo[$memberid]['uname'] =  '';
                $this->memberinfo[$memberid]['name'] = '';
                $this->memberinfo[$memberid]['sex'] =  '';
                $this->memberinfo[$memberid]['point'] = 0;
                $this->memberinfo[$memberid]['usage_point'] = 0;
           } else {
               if( !$this->memberinfo[$memberid] )
                   $this->memberinfo[$memberid] = kernel::single('b2c_frontpage')->get_member_info( $memberid );
               
           }
           return $this->memberinfo[$memberid];
       } else {
           return kernel::single('b2c_frontpage')->get_current_member();
       }
   }
   
   public function set_member_id( $memberid ) {
       $this->__member_id = $memberid;
   }
   
    
}
